const router = require('koa-router');
const { verifyToken, verifyPermission } = require('../middleWare/middleWare');
const { create,list,searchById,update,remove} = require('../controller/moment.controller');
const monmentRouter = new router({
    prefix:'/moment'
})

//注册中间件:发表评论,使用中间件进行注册

monmentRouter.post('/', verifyToken, create);

//让用户查看评论:限制一下开始位置和查询的条数
monmentRouter.get('/list', list);
monmentRouter.get('/list/:id', searchById);

//修改数据
monmentRouter.patch('/list/:id', verifyToken, verifyPermission, update);

//删除数据
monmentRouter.delete("/list/:id", verifyToken, verifyPermission, remove);

module.exports = monmentRouter;